Swap to ktfmt (googleStyle) for Kotlin code, but keep ktlint for Gradle scripts #245
Merged
will-molloy merged 3 commits intomainfrom Jan 13, 2025
Merged
Swap to ktfmt (googleStyle) for Kotlin code, but keep ktlint for Gradle scripts #245will-molloy merged 3 commits intomainfrom
ktfmt (googleStyle) for Kotlin code, but keep ktlint for Gradle scripts #245will-molloy merged 3 commits intomainfrom
Conversation
Have been finding inconsistent results with `ktlint`. I.e. it preserves custom formatting, which you do not want. It should have deterministic output. `ktfmt` was made to solve that: https://github.com/facebook/ktfmt?tab=readme-ov-file#faq I think they should work together? Need to use for a bit to make sure. Still want `ktlint` as it handles some bits better like space between methods.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #245 +/- ##
===========================================
Coverage 100.00% 100.00%
Complexity 5 5
===========================================
Files 2 2
Lines 6 6
===========================================
Hits 6 6
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
will-molloy
added a commit
to will-molloy/coding-practice-java
that referenced
this pull request
Jan 6, 2025
… (#233) Seems like this is the way to go...? Related: will-molloy/java-template#245 GitOrigin-RevId: 65b15a6b34bff8a4072558e718b2ed055c44ecf6
will-molloy
commented
Jan 6, 2025
| * @author <a href=https://willmolloy.com>Will Molloy</a> | ||
| */ | ||
| class HelloWorld { | ||
|
|
Owner
Author
There was a problem hiding this comment.
ktlint removes this space... but not always ???
ktfmtktfmt (googleStyle) for Kotlin code, but keep ktlint for Gradle scripts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
ktfmtseems better thanktlint(more deterministic/consistent output). Furthermore, using spotless more for formatting than linting.However,
ktfmthas some weird output with Gradle scripts, so keepingktlintfor that.